package com.sy.controller;

import com.sy.dto.JsonResult;
import com.sy.entity.Student;
import com.sy.sevice.StudentService;
import com.sy.vo.AddStudentVo;
import com.sy.vo.LoginUserVo;
import com.sy.vo.ModifyStudentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Monkey-D-Gu
 * @version 1.0
 * @date 2020/9/11 0011 11:26
 * @usage 学生类相关的控制器
 */
@RestController
@RequestMapping("students")
public class StudentController {

    @Autowired
    private StudentService studentService;

    /**
     * 新增学生信息
     * @return JsonResult对象
     */
    @RequestMapping(value = "",method = RequestMethod.POST)
    public JsonResult addStudent(@RequestBody AddStudentVo addStudentVo){
        System.out.println(addStudentVo);
        return studentService.addStudent(addStudentVo);
    }
    /**
     * @author JianBo-Shneg
     * @version 1.0
     * @date 2020/9/14 0011 13:48
     * 修改学生个人信息
     * @param modifyStudentVo 学生信息携带对象
     * @return 修改成功的学生信息
     */
    @RequestMapping(value = "",method = RequestMethod.PUT)
    public JsonResult updateStudent(@RequestBody ModifyStudentVo modifyStudentVo){
        System.out.println(modifyStudentVo);
        return studentService.modifyStudent(modifyStudentVo);
    }
}
